/************** init.html **************/


function organType_editHandle(code) {
	var url = create_url('organType-editHandle');
	var parm = {'code':code};
	$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'800px', height:'600px', open:true});
}


function organType_queryOrganType(page) {
	var parm = $('#queryOrganTypeForm').serialize() + sys_get_page(page);
	var url = create_url('organType-query');
	sys_record_parm('organType', parm);
	sys_loading();
	sys_record_parm('organType',parm);
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#organTypeResultList').html(result);
		}
	});
}

function organType_aidExecuteOrganType(code, url) {
	var parm = {'code':code};
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if ('success' == result) {
				organType_queryOrganType();
			} else {
				sys_msg('删除失败');
			}
		}
	});
}

function organType_deleteOrganType(code, name) {
	$.Zebra_Dialog('确认要删除 ' + name + ' 机构的信息吗？',{
	'type': 'question',
	'title': '警告' ,
	'buttons':[
	           {caption:'确认',callback:function() {
	    			var url = create_url('organType-delete');
	    			organType_aidExecuteOrganType(code, url);
	    		}},
	           {caption:'取消',callback:function(){}
	    	}]
	});
	
	/*jConfirm('确认要删除 ' + name + ' 机构的信息吗？', '警告', function(r) {
		if(r == true){
			var url = create_url('organType-delete');
			organType_aidExecuteOrganType(code, url);
		}
	});*/
	
}

/************** edit.html **************/

function organType_saveOrganType() {
	var parm = $('#editOrganTypeForm').serialize();
	var url = create_url('organType-save');
	sys_submiting();
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_submiting_close();
			if (result == 'success') {
				sys_msg('保存成功');
				sys_load_handle('organType');
			} else {
				sys_msg('保存失败');
			} 
		}
	});
}
